import logging

from price_analysis.utils.file_support import read_ocr_file, get_ocr_files_list

logger = logging.getLogger("main")


async def get_recognized_data(file_name: str) -> dict:
    logger.info(f"Файл {file_name} прочитан")
    return await read_ocr_file(file_name)


async def get_all_recognized_data() -> list[dict]:
    ocr_file_list = await get_ocr_files_list()
    recognized_data: list[dict] = []

    for file_name in ocr_file_list:
        data = await get_recognized_data(file_name)
        recognized_data.append(data)

    return recognized_data
